package com.three.vip.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.three.core.entity.Car;
import com.three.core.vo.R;
import com.three.vip.service.CarService;
import com.three.vip.vo.AddCarVo;
import com.three.vip.vo.CarBindVo;
import com.three.vip.vo.SearchFormVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author ：JinShiYan
 * @date ：Created in 2025/3/12 15:44
 * @description：
 * @modified By：
 * @version:
 */

@RestController
@RequestMapping("/vip/car")
public class CarController {

    @Autowired
    private CarService carService;

    /*
    * 查询所有车辆信息
    * */
    @PostMapping("/CarManagement")
    public R<IPage<Car>> CarManagement(@RequestBody SearchFormVo searchFormVo) {
        return carService.selectAll(searchFormVo);
    }

    @GetMapping("/carBind")
    public R<List<CarBindVo>> carBind() {
        return carService.carBind();
    }

    @GetMapping("/findCarId")
    public R<Car> findCarId(Integer carId) {
        return carService.findCarId(carId);
    }

    @PostMapping("/addCar")
    public R<Car> addCar(@RequestBody AddCarVo addCarVo) {
        return carService.addCar(addCarVo);
    }

    @DeleteMapping("/deleteCarNo")
    public R deleteCarNo(String carNo) {
        return carService.deleteCarNo(carNo);
    }
}
